package com.frikinet.gestorepub.web.spring.controllers;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.frikinet.gestorepub.web.spring.services.PersistenceService;

@Controller
@RequestMapping("/test")
public class TestController
{
	@Autowired
	private PersistenceService persistenceService;
	
	@RequestMapping("/book/{id}")
	public ModelAndView viewBook(@PathVariable Long id)
	{
		ModelAndView mav = new ModelAndView("test/book");
		mav.addObject("book", persistenceService.getBook(id));
		return mav;
	}
}
